package PortAudioAda.Linux_Alsa is

   type PaAlsaStreamInfo is
      record
         size         : aliased IC.unsigned_long;
         hostApiType  : aliased PaHostApiTypeId;
         version      : aliased IC.unsigned_long;
         deviceString : aliased ICS.chars_ptr;
      end record;
   pragma Convention (C, PaAlsaStreamInfo);

   -----------------------------------------------------------------------------
   --  Initialize host API specific structure, call this before setting relevant
   --  attributes.
   procedure PaAlsa_InitializeStreamInfo (info : access PaAlsaStreamInfo);
   pragma Import (C,
                  PaAlsa_InitializeStreamInfo,
                  "PaAlsa_InitializeStreamInfo");

   -----------------------------------------------------------------------------
   --  Instruct whether to enable real-time priority when starting the audio
   --  thread.
   --
   --  If this is turned on by the stream is started, the audio callback thread
   --  will be created with the FIFO scheduling policy, which is suitable for
   --  realtime operation.
   procedure PaAlsa_EnableRealtimeScheduling (s      : PaStream;
                                              enable : Integer);
   pragma Import (C,
                  PaAlsa_EnableRealtimeScheduling,
                  "PaAlsa_EnableRealtimeScheduling");

   -----------------------------------------------------------------------------
   --  Get the ALSA-lib card index of this stream's input device.
   function PaAlsa_GetStreamInputCard (s    :        PaStream;
                                       card : access Integer)
                                       return PaError;
   pragma Import (C,
                  PaAlsa_GetStreamInputCard,
                  "PaAlsa_GetStreamInputCard");

   -----------------------------------------------------------------------------
   --  Get the ALSA-lib card index of this stream's output device.
   function PaAlsa_GetStreamOutputCard (s    :        PaStream;
                                        card : access Integer)
                                        return PaError;
   pragma Import (C,
                  PaAlsa_GetStreamOutputCard,
                  "PaAlsa_GetStreamOutputCard");

   -----------------------------------------------------------------------------
   --  Set the number of periods (buffer fragments) to configure devices with.
   --
   --  By default the number of periods is 4, this is the lowest number of
   --  periods that works well on the author's soundcard.
   --  @param numPeriods The number of periods.
   function PaAlsa_SetNumPeriods (numPeriods : Integer) return PaError;
   pragma Import (C, PaAlsa_SetNumPeriods, "PaAlsa_SetNumPeriods");

   -----------------------------------------------------------------------------
   --  Set the maximum number of times to retry opening busy device (sleeping
   --  for a short interval inbetween).
   function PaAlsa_SetRetriesBusy (retries : Integer) return PaError;
   pragma Import (C, PaAlsa_SetRetriesBusy, "PaAlsa_SetRetriesBusy");

   -----------------------------------------------------------------------------
   --  Set the path and name of ALSA library file if PortAudio is configured to
   --  load it dynamically.
   procedure PaAlsa_SetLibraryPathName (pathName : String);
   pragma Inline (PaAlsa_SetLibraryPathName);

end PortAudioAda.Linux_Alsa;
